/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: DickYang
 * Date: 2023-06-30
 * Time: 17:34
 */
public class Test {
    public static void main(String[] args) {
        MySingleList mySingleList = new MySingleList();
        mySingleList.addLast(12);
        mySingleList.addLast(45);
        mySingleList.addLast(32);
        mySingleList.addLast(13);
        mySingleList.addLast(23);

        Node ret = mySingleList.partition(mySingleList.getHead(),15);
        mySingleList.display(ret);
    }
    public static void main4(String[] args) {
        MySingleList mySingleList = new MySingleList();
        mySingleList.addLast(1);
        mySingleList.addLast(2);
        mySingleList.addLast(3);
        mySingleList.addLast(2);
        mySingleList.addLast(1);
        System.out.println(mySingleList.chkPalindrome(mySingleList.getHead()));
    }

    public static void main3(String[] args) {
        MySingleList mySingleList1 = new MySingleList();
        mySingleList1.addLast(12);
        mySingleList1.addLast(23);
        mySingleList1.addLast(45);
        mySingleList1.addLast(80);
        mySingleList1.addLast(90);

        MySingleList mySingleList2 = new MySingleList();
        mySingleList2.addLast(17);
        mySingleList2.addLast(18);
        mySingleList2.addLast(81);

        MySingleList mySingleList = new MySingleList();
        Node ret = mySingleList.mergeTwoLists(mySingleList1.getHead(),mySingleList2.getHead());
        mySingleList.display(ret);
    }
    public static void main2(String[] args) {
        MySingleList mySingleList = new MySingleList();
        System.out.println("===尾插法===");

        mySingleList.addLast(1);
        mySingleList.addLast(2);
        mySingleList.addLast(3);
        mySingleList.addLast(4);
        mySingleList.addLast(5);
        Node ret = mySingleList.FindKthToTail(6);
        mySingleList.display(ret);
//        Node ret = mySingleList.reverseList();
//        mySingleList.display(ret);
//        Node ret = mySingleList.middleNode();
//        mySingleList.display(ret);

    }

    public static void main1(String[] args) {
        MySingleList mySingleList = new MySingleList();
        System.out.println("===头插法===");
        mySingleList.addFirst(13);
        mySingleList.addFirst(13);
        mySingleList.addFirst(34);
        mySingleList.addFirst(34);
        mySingleList.display();
        System.out.println(mySingleList.size());
        System.out.println("===尾插法===");
        mySingleList.addLast(467);
        mySingleList.addLast(67);
        mySingleList.display();
        System.out.println(mySingleList.size());
        System.out.println("===中间插===");
        try {
            mySingleList.addIndex(3,12);
        } catch (IndexOutOfException e) {
            e.printStackTrace();
        }
        mySingleList.display();
        System.out.println(mySingleList.size());
//        System.out.println("===删除第一个key===");
//        mySingleList.remove(34);
//        mySingleList.display();
        System.out.println("===删除所有的key===");
        mySingleList.removeAllKey(34);
        mySingleList.display();

//        System.out.println("======");
//        mySingleList.clear();
//        mySingleList.display();

    }
}
